package com.hgz.sbj.job;

import java.math.BigDecimal;

import com.hgz.sbj.mapper.TFxRecordMapper;
import com.hgz.sbj.model.TFxRecord;
import com.hgz.sbj.util.SpringUtil;

public class Excuter {
	
	private TFxRecordMapper tFxRecordMapper = null;
	
	private boolean isSetLossOrProfit;//是否设置了止盈点和止损点
	
	public void analyExcuteData(int fxId){
		//获取交易记录数据
		tFxRecordMapper = SpringUtil.getBean(TFxRecordMapper.class);
		TFxRecord record = tFxRecordMapper.selectByPrimaryKey(fxId);
		
		//是否设置了止盈点和止损点
		isSetLossOrProfit = isSetLossOrProfit(record);
		//
	}
	
	/**
	 * 是否设置了止盈点和止损点，其中一个没有设置则返回false，否则返回true
	 * @param record
	 * @return
	 */
	private boolean isSetLossOrProfit(TFxRecord record){
		BigDecimal stopLoss = record.getStopLoss();
		BigDecimal targetProfit = record.getTargetProfit();
		if(stopLoss == null || targetProfit == null){
			return false;
		}
		return true;
	}

}
